from django.contrib import admin
from .models import Account, Postion, OrderRecord

# Register your models here.


class PositionInline(admin.StackedInline):
    model = Postion
    extra = 0


class OrderRecordInline(admin.StackedInline):
    model = OrderRecord
    extra = 0


class AccountAdmin(admin.ModelAdmin):
    fieldsets = [
        (None, {'fields': ['user_name']}),
        ('Money Information', {'fields': ['money'], 'classes': ['collapse']}),
    ]
    inlines = [PositionInline, OrderRecordInline]
    list_display = ('user_name', 'money', 'was_money_recently')
    search_fields = ['user_name']


admin.site.register(Account, AccountAdmin)
